import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ModalBaseComponent } from '../../../../shared/components/modalBase/modalBase.component';

@Component({
  selector: 'm-task-add',
  templateUrl: './m-task-add.component.html',
  styleUrls: ['./m-task-add.component.scss']
})
export class MTaskAddComponent extends ModalBaseComponent implements OnInit {
  taskInfo: FormGroup;

  @Output()
  onAdd: EventEmitter<any> = new EventEmitter();

  constructor(
    private formBuilder: FormBuilder
  ) {
    super();
  }

  ngOnInit() {
    this.taskInfo = this.formBuilder.group({
      tags: '',
      content: ''
    });
  }

  clickOK() {
    this.show = false;
    this.onAdd.emit(this.taskInfo.value);
  }
}
